<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>1</div>
    <div>2</div>
    <div>3</div>

    <script>
        // 转换为真数组
        // 1. 得到伪数组
        const divs = document.querySelectorAll('div')
        console.log(divs) // NodeList(3) [div, div, div] 伪数组
        // divs.push(123)

        // 2. 转换为真数组 Array.from() 返回真数组 不会影响原来的伪数组
        const newArr  = Array.from(divs)
        console.log(newArr) // [div, div, div]
        newArr.push(123)
        console.log(newArr) // [div, div, div, 123]
        console.log(divs) // NodeList(3) [div, div, div]
        
        
        
    </script>
</body>
</html>